<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>CUTMS</title>
    <link rel="stylesheet" href="../plugin/layui-v2.2.5/layui/css/layui.css">
    <link rel="stylesheet" href="../css/cutms.css">
    <link rel="stylesheet" href="../css/login.css">
    <link rel="stylesheet" href="../plugin/font-awesome/css/font-awesome.min.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">课程材料归档管理系统</div>
    </div>

    <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">

        <div class="layadmin-user-login-main">
            <div class="layadmin-user-login-box layadmin-user-login-header">
                <h2>登录系统</h2>
            </div>
            <form class="layui-form layui-form-pane" method="POST">
                <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"><i class="fa fa-user-o"></i></label>
                        <input type="text" name="account" id="LAY-user-login-username" lay-verify="required" placeholder="请输入用户名或工号" class="layui-input">
                    </div>
                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"><i class="fa fa-unlock-alt"></i></label>
                        <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="请输入密码" class="layui-input">
                    </div>
                    <div class="layui-form-item" style="margin-bottom: 20px;">
                    </div>
                        <a lay-href="" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn layui-btn-fluid" lay-submit="" lay-filter="user_login">登 录</button>
                    </div>
                </div>
            </form>
        </div>

    </div>
<script src="../plugin/layui-v2.2.5/layui/layui.js"></script>
<script src="../plugin/jquery-3.1.1.min.js"></script>
<script>
    //JavaScript代码区域
    layui.use(['layer', 'form', 'laydate'], function () {
        var layer = layui.layer
            , form = layui.form
            , element = layui.laydate

        //监听提交
        form.on('submit(user_login)', function (data) {
            console.log(data.field);
            $.ajax({ 
            	url: "/CMA/shiro/login",
            	data : data.field,
            	contentType: "application/x-www-form-urlencoded",
            	type:"post",
            	dataType : "json",
            	success: function(data){
            		console.log(data.result);
            		if(data.result == "success"){
            			window.location.href = "schoolManage.html";
            		}else{
            			layer.msg(data.result, {
            		        time: 2000, //20s后自动关闭
            		      });
            		}
                 }
              });
            return false;
        });
    });
</script>
</body>
</html>